package cn.zj.admin.bean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 菜单信息
 * @author xi.yang
 * @create 2020-10-23 14:31
 **/
public class MenuInfo implements Serializable {
    private int level;
    private String tag;
    private String title;
    private String icon;
    private String href = "";
    private String target = "_self";
    private List<MenuInfo> child = new ArrayList<>();

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getHref() {
        return href;
    }

    public int getLevel() {
        return level;
    }

    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public void setHref(String href) {
        this.href = href;
    }

    public String getTarget() {
        return target;
    }

    public void setTarget(String target) {
        this.target = target;
    }

    public List<MenuInfo> getChild() {
        return child;
    }

    public void setChild(List<MenuInfo> child) {
        this.child = child;
    }

    public static MenuInfoBuilder builder() {
        return new MenuInfoBuilder();
    }

    public static final class MenuInfoBuilder {
        private int level;
        private String tag;
        private String title;
        private String icon;
        private String href = "";
        private String target = "_self";
        private List<MenuInfo> child = new ArrayList<>();

        private MenuInfoBuilder() {
        }

        public MenuInfoBuilder level(int level) {
            this.level = level;
            return this;
        }

        public MenuInfoBuilder tag(String tag) {
            this.tag = tag;
            return this;
        }

        public MenuInfoBuilder title(String title) {
            this.title = title;
            return this;
        }

        public MenuInfoBuilder icon(String icon) {
            this.icon = icon;
            return this;
        }

        public MenuInfoBuilder href(String href) {
            this.href = href;
            return this;
        }

        public MenuInfoBuilder target(String target) {
            this.target = target;
            return this;
        }

        public MenuInfoBuilder child(List<MenuInfo> child) {
            this.child = child;
            return this;
        }

        public MenuInfo build() {
            MenuInfo menuInfo = new MenuInfo();
            menuInfo.setLevel(level);
            menuInfo.setTag(tag);
            menuInfo.setTitle(title);
            menuInfo.setIcon(icon);
            menuInfo.setHref(href);
            menuInfo.setTarget(target);
            menuInfo.setChild(child);
            return menuInfo;
        }
    }
}
